package com.cyj.config.config;



import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class Swagger {

    @Bean
    public Docket group1() {
        return new Docket(DocumentationType.OAS_30) // v2 不同
                .apiInfo(apiInfo())
                .groupName("小组1")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.cyj.controller")) // 设置扫描路径
                .paths(PathSelectors.any())
                .build()
                ;
    }
//    @Bean
//    public Docket group2() {
//        return new Docket(DocumentationType.OAS_30) // v2 不同
//                .apiInfo(apiInfo())
//                .groupName("小组2")
//                .select()
//                .apis(RequestHandlerSelectors.basePackage("com.cyj.controller")) // 设置扫描路径
//                .paths(PathSelectors.any())
//                .build()
//                ;
//    }

    private ApiInfo apiInfo(){
        return new ApiInfoBuilder().title("接口文档").description("By cyj").version("1.0.0")
                .contact(new Contact("aaaa","http://localhost:8081/","cyj@example.com")).build();
    }
}
